using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Linq.Mapping;
using ZhiAo.Entities;
using ZhiAo.Entities.Builder;
 
namespace ZhiAo.Entities
{
    ///<summary>
	///[SQ_STBPRP_B]
	///</summary>
    [Serializable]
	[Table(Name = "SQ_STBPRP_B")]
    public partial class SqStbprpB
	{
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "YR_STCD")]
	      public string YrStcd { get { return this._YrStcd; }  set{ this._YrStcd=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.YrStcd); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "STCD")]
	      public string Stcd { get { return this._Stcd; }  set{ this._Stcd=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Stcd); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "STCD8")]
	      public string Stcd8 { get { return this._Stcd8; }  set{ this._Stcd8=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Stcd8); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "STNM")]
	      public string Stnm { get { return this._Stnm; }  set{ this._Stnm=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Stnm); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "RVNM")]
	      public string Rvnm { get { return this._Rvnm; }  set{ this._Rvnm=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Rvnm); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "HNNM")]
	      public string Hnnm { get { return this._Hnnm; }  set{ this._Hnnm=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Hnnm); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "BSNM")]
	      public string Bsnm { get { return this._Bsnm; }  set{ this._Bsnm=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Bsnm); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "LGTD")]
	      public string Lgtd { get { return this._Lgtd; }  set{ this._Lgtd=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Lgtd); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "LTTD")]
	      public string Lttd { get { return this._Lttd; }  set{ this._Lttd=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Lttd); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "QUHAO")]
	      public string Quhao { get { return this._Quhao; }  set{ this._Quhao=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Quhao); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "SHI")]
	      public string Shi { get { return this._Shi; }  set{ this._Shi=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Shi); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "XIAN")]
	      public string Xian { get { return this._Xian; }  set{ this._Xian=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Xian); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "JIEDAO")]
	      public string Jiedao { get { return this._Jiedao; }  set{ this._Jiedao=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Jiedao); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "STLC")]
	      public string Stlc { get { return this._Stlc; }  set{ this._Stlc=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Stlc); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "STTP")]
	      public string Sttp { get { return this._Sttp; }  set{ this._Sttp=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Sttp); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "TXTP")]
	      public string Txtp { get { return this._Txtp; }  set{ this._Txtp=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Txtp); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "STJM")]
	      public System.Nullable<double> Stjm { get { return this._Stjm; }  set{ this._Stjm=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.Stjm); } } 
		  ///<summary>
          ///[]
          ///</summary>
		  [Column(Storage = "YR_FLG")]
	      public string YrFlg { get { return this._YrFlg; }  set{ this._YrFlg=value; if (this.DataModelBegin)AddEnum(SqStbprpBEnum.YrFlg); } } 
		
		/// <summary>
		/// ????????:???????True?,????????,?????????????????????,???????????????????????????????????
		/// </summary>
	    public void StartSetSQLValue()
        {
            this.DataModelBegin = true;
        }

		/// <summary>
		/// ???????
		/// </summary>
        public void EndSetSQLValue()
        {
            this.DataModelBegin = false ;
        }
		
		 private bool DataModelBegin;
		 public List<SqStbprpBEnum> ListEnum { get; set; }
		
	     public void AddEnum(SqStbprpBEnum item)
         {
            if (ListEnum == null) ListEnum = new List<SqStbprpBEnum>();
		    if (!ListEnum.Contains(item))
            {
                ListEnum.Add(item);
            }
          }
		
	 
		
		private  SqStbprpBEnum _keyField;
	    public  SqStbprpBEnum KeyField { get { return this._keyField;} }

        public void SetKeyField(SqStbprpBEnum keyField)
        {
            this.HasSetKeyField = true;
            this._keyField = keyField;
        }
 
        public SqStbprpB()
        {
        }

        public SqStbprpB(SqStbprpBEnum keyField)
        {
            this.HasSetKeyField = true;
            this._keyField = keyField;
        }

        public bool HasSetKeyField { get; set; }
		
		public SqStbprpBEnum SortByField { get; set; }
		
		public SortDirection SortDirection { get; set; }
		
		
		public string SQLUpdate
        {
           get{ return new SQLBuilder<SqStbprpB, SqStbprpBEnum>().Update(this);}
        }

        public string SQLInsert
        {
           get{ return new SQLBuilder<SqStbprpB, SqStbprpBEnum>().Insert(this);}
        }

        public string SQLDelete
        {
		    get{ return new SQLBuilder<SqStbprpB, SqStbprpBEnum>().Delete(this);}
        }
		
		public string SQLSelect
        {
            get { return new SQLBuilder<SqStbprpB, SqStbprpBEnum>().Select(this); }
        }
		
		public void SetAllEnum()
        {
            new SQLBuilder<SqStbprpB, SqStbprpBEnum>().SetAllEnum(this);
        }

        private DataTable FetchDataTable()
        {
            return FetchDataTable(null);
        }
		
		private DataTable FetchDataTable(object ts)
        {
            return new ZhiAo.Entities.Builder.EntityBuilder<SqStbprpB, SqStbprpBEnum>().GetDataTable(this,ts);
        }

        /// <summary>
        /// ???????????????????FetchEntity??????
        /// </summary>
	    public bool HasFetchData { get; set; }

        /// <summary>
        /// ??????????????????????FetchEntity??????
        /// </summary>
        public bool NotFetchData{ get { return !HasFetchData; }  }

        /// <summary>
        /// ??????-???????SQL
        /// </summary>
        /// <returns>???:???????????????????????? ??????????????HasFetchData??????</returns>
        public SqStbprpB FetchEntity()
        {
           return  FetchEntity("",null);
        }
		
        /// <summary>
        /// ??????-???SQL???
        /// </summary>
        /// <param name="sql">??????</param>
        /// <returns>???:???????????????????????? ??????????????HasFetchData??????</returns>
		public SqStbprpB FetchEntity(string sql)
        {
           return  FetchEntity(sql,null);
        }
		
        /// <summary>
        /// ??????-???????SQL
        /// </summary>
        /// <param name="ts">????</param>
        /// <returns>???:???????????????????????? ??????????????HasFetchData??????</returns>
		public SqStbprpB FetchEntity(object ts)
        {
           return  FetchEntity("",ts);
        }
		
        /// <summary>
        /// ??????-???SQL???
        /// </summary>
        /// <param name="sql">??????</param>
        /// <param name="ts">????</param>
        /// <returns>???:???????????????????????? ??????????????HasFetchData??????</returns>
		public SqStbprpB FetchEntity(string sql,object ts)
        {
            return new ZhiAo.Entities.Builder.EntityBuilder<SqStbprpB, SqStbprpBEnum>().GetEntity(sql,this,ts);
        }

        /// <summary>
        /// ?????????-???????SQL
        /// </summary>
        /// <returns>??????</returns>
		public List<SqStbprpB> FetchEntities()
        {
            return  FetchEntities("",null); 
        }
		
        /// <summary>
        ///  ?????????-???SQL???
        /// </summary>
        /// <param name="sql">??????</param>
        /// <returns>??????</returns>		
	    public List<SqStbprpB> FetchEntities(string sql)
        {
            return FetchEntities(sql,null);
        }
		
        /// <summary>
        /// ?????????-???????SQL
        /// </summary>
        /// <param name="ts">????</param>
        /// <returns>??????</returns>
	    public List<SqStbprpB> FetchEntities(object ts)
        {
            return FetchEntities("", ts);
        }
		
        /// <summary>
        ///  ?????????-???SQL???
        /// </summary>
        /// <param name="sql">??????</param>
        /// <param name="ts">????</param>
        /// <returns>??????</returns>
	    public List<SqStbprpB> FetchEntities(string sql,object ts)
        {
            return new ZhiAo.Entities.Builder.EntityBuilder<SqStbprpB, SqStbprpBEnum>().GetEntities(sql,this,ts);
        }
		
		/// <summary>
        /// ?????????????
        /// </summary>
        /// <returns>True???? False??????</returns>
		public bool Exists()
        {
            return Exists(null);
        }

        /// <summary>
        ///  ?????????????
        /// </summary>
        /// <param name="ts">????</param>
        /// <returns>True???? False??????</returns>
	    public bool Exists(object ts)
        {
            SqStbprpB item = this.FetchEntity(ts);
            return item.HasFetchData;
        }
		
		
		
		
    }
	
	
	public partial class SqStbprpB
	{
	      private string _YrStcd = "";
	      private string _Stcd = "";
	      private string _Stcd8 = "";
	      private string _Stnm = "";
	      private string _Rvnm = "";
	      private string _Hnnm = "";
	      private string _Bsnm = "";
	      private string _Lgtd = "";
	      private string _Lttd = "";
	      private string _Quhao = "";
	      private string _Shi = "";
	      private string _Xian = "";
	      private string _Jiedao = "";
	      private string _Stlc = "";
	      private string _Sttp = "";
	      private string _Txtp = "";
	      private System.Nullable<double> _Stjm;
	      private string _YrFlg = "";
    }
 

  public enum  SqStbprpBEnum
  {
		  ///<summary>
          ///[]
          ///</summary>
	     YrStcd ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Stcd ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Stcd8 ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Stnm ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Rvnm ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Hnnm ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Bsnm ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Lgtd ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Lttd ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Quhao ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Shi ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Xian ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Jiedao ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Stlc ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Sttp ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Txtp ,   
		  ///<summary>
          ///[]
          ///</summary>
	     Stjm ,   
		  ///<summary>
          ///[]
          ///</summary>
	     YrFlg    
   }
}
